﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MoetutuServer.PublishHelper;
using MoetutuServer.Helper;
using MoetutuServer.Helper.RepairHelper;

namespace MoetutuServer.RepairHelper
{
    public partial class RepairControl : UserControl
    {
        public RepairControl()
        {
            InitializeComponent();
            InitView();
        }

        private void InitView()
        {
            comboBox1.Items.AddRange(new List<string>() { "图片修复", "字符串替换","TAG添加修复" }.ToArray());
            comboBox1.SelectedIndex = 2;
          
        }

        private void button6_Click(object sender, EventArgs e)
        {
            ModeSwitch();
        }

        private void ModeSwitch()
        {
            switch (comboBox1.Text) {
                case "图片修复":
                StartScanner.AnalysisContent(StaticValue.PostUser, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox1.Text));
                    break;
                case "字符串替换":
                    StartScanner.ReplaceText(StaticValue.PostUser, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox1.Text), textBox4.Text, textBox5.Text);
                    break;
                case "TAG添加修复":
                    StartScanner.RepairTag(StaticValue.PostUser, Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox1.Text));
                    break;
            }
            
        }

        private void button7_Click(object sender, EventArgs e)
        {
            ModifyContent.ModifySingle(StaticValue.PostUser, textBox2.Text);
        }
    }
}
